package com.song.crud.controller;

import com.song.crud.pojo.Department;
import com.song.crud.pojo.Msg;
import com.song.crud.service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author 宋超
 * HP - the login name of the current user.
 * 2020/10/15 - the current system date.
 * 10:23 - the current system time.
 * 处理Department部门有关的请求
 */
@Controller
public class DepartmentController {

    @Autowired
    private DepartmentService departmentService;


    @RequestMapping("/depts")
    @ResponseBody
    public Msg getDepts(){
        //查出部门所有信息
        List<Department> list = departmentService.getAll();
        return Msg.success().add("depts",list);
    }
}
